//package cn.nfwx.tv.fragment;
//
//import android.os.Bundle;
//import android.support.annotation.Nullable;
//import android.support.v4.app.Fragment;
//import android.support.v4.app.FragmentManager;
//import android.support.v4.app.FragmentPagerAdapter;
//import android.support.v4.view.ViewPager;
//import android.view.LayoutInflater;
//import android.view.View;
//import android.view.ViewGroup;
//
//import com.flyco.tablayout.SlidingTabLayout;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import cn.nfwx.tv.R;
//import cn.nfwx.tv.base.BaseFragment;
//
//
///***
// * 登录
// * Created by zb.liu on 2018/01/05.
// */
//public class LoginAndRegisterFragment extends BaseFragment {
//    private final static String TAG_LOG = LoginAndRegisterFragment.class.getSimpleName();
//    private SlidingTabLayout commonTabLayout;
//    private ViewPager viewPager;
//    private ArrayList<Fragment> fragmentList = new ArrayList<>();
//    private LoginFragment loginFragment;
//    private RegisterFragment registerFragment;
//    private String[] titles = {"登录", "注册"};
//    private View view;
//    private static String TYPE_KEY = "currentPosition";
//    private int currentPosition = 0;
//
//    public static LoginAndRegisterFragment newInstance(int index) {
//        LoginAndRegisterFragment fragment = new LoginAndRegisterFragment();
//        Bundle bundle = new Bundle();
//        bundle.putInt(TYPE_KEY, index);
//        fragment.setArguments(bundle);
//        return fragment;
//    }
//
//    @Override
//    public void onCreate(@Nullable Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//    }
//
//    @Override
//    public View initView() {
//        view = View.inflate(getActivity(), R.layout.fragment_login_main2, null);
//        init();
//        return view;
//    }
//
//    public void init() {
//        currentPosition = getArguments().getInt(TYPE_KEY);
//        viewPager = view.findViewById(R.id.login_viewPager);
//        commonTabLayout = view.findViewById(R.id.tab_login_top);
//        loginFragment = new LoginFragment();
//        registerFragment = new RegisterFragment();
//        fragmentList.clear();
//        fragmentList.add(loginFragment);
//        fragmentList.add(registerFragment);
//        viewPager.setAdapter(new LoginAdapter(this.getChildFragmentManager(), fragmentList));
//        viewPager.setOffscreenPageLimit(2);
//        commonTabLayout.setViewPager(viewPager, titles);
//    }
//
//    @Override
//    public void onStart() {
//        super.onStart();
//        commonTabLayout.setCurrentTab(currentPosition);
//    }
//
//    public void setData(int index) {
//        Bundle bundle = new Bundle();
//        bundle.putInt(TYPE_KEY, index);
//        this.setArguments(bundle);
//    }
//
//    public void select(int index) {
//        commonTabLayout.setCurrentTab(index);
//    }
//
//    class LoginAdapter extends FragmentPagerAdapter {
//        private List<Fragment> list;
//
//        public LoginAdapter(FragmentManager fm, List<Fragment> list) {
//            super(fm);
//            this.list = list;
//        }
//
//        @Override
//        public Fragment getItem(int position) {
//            return list.get(position);
//        }
//
//        @Override
//        public int getCount() {
//            return list.size();
//        }
//    }
//}
